package com.vincent.suchao.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.Gallery.LayoutParams;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.vincent.suchao.entity.YWJS_EntityList;
import com.vincent.suchao.entity.YWJS_EntityList.YWJS;
import com.vincent.suchao.lcld.R;

public class YWJSAdapter extends BaseAdapter {

	private Context context;
	private LayoutInflater mInflater;
	YWJS_EntityList list;

	public YWJSAdapter(Context mcontext) {
		super();
		this.context = mcontext;
		this.mInflater = LayoutInflater.from(context);
		this.list = new YWJS_EntityList(mcontext);
	}

	@Override
	public int getCount() {
		return list.getList().size();
	}

	@Override
	public Object getItem(int position) {
		return list.getList().get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		YWJS menuItem = (YWJS) list.getList().get(position);
		ImageView image = new ImageView(context);
		image.setImageResource(menuItem.getResID());
		image.setAdjustViewBounds(true);
		image.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		return image;
	}

}
